import axios from 'axios'
import React, { Component } from 'react'
import './index.css';
export default class Movie extends Component {
    state = {
        movies: []
    }

    render() {
        return (
            <div>
                <div className="container">
                    <h2>正在热映...</h2>
                    <hr />
                    <div className="movie-list">
                        <div className="row">
                        {
                            this.state.movies.map((item, index) => {
                                return <div key={index} className="item">
                                    <img width="100%" src={item.img.replace('/w.h','') + '@214w_297h_1e_1c'} alt="" />
                                    <div className="mask"></div>
                                    <div className="title">{item.nm}</div>
                                    <div className="rate">{item.sc}</div>
                                </div>
                            })
                        }
                    </div>
                    </div>
                </div>
            </div>
        )
    }

    async componentDidMount() {
        let response = await axios.get('/maoyan/ptapi/getHotFilms?ci=1&limit=10');

        this.setState({
            movies: response.data.data.hot
        })
    }
}
